package com.erp.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.erp.dto.Privilege;

@SuppressWarnings("serial")
@Entity
@Table(name = "t_privilege")
public class TPrivilege implements java.io.Serializable {

	/**
	 * 默认构造方法
	 */
	public TPrivilege() {
	}

	public TPrivilege(String name, String url, Integer orderNumber,
			Integer level, TPrivilege parent) {
		this.name = name;
		this.url = url;
		this.orderNumber = orderNumber;
		this.level = level;
		this.parent = parent;
	}

	/**
	 * 将数据传输对象转化为持久化对象(还没写)
	 * 
	 * @param privilege
	 */
	public TPrivilege(Privilege privilege) {
		// TODO 
	}

	private Integer id;
	private String name;
	private String url;
	private String description;
	private Integer orderNumber;
	private Integer level;
	private TPrivilege parent;

	@Id
	@GeneratedValue
	@Column(name = "id")
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "name")
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "url")
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	@Column(name = "description")
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "orderNumber")
	public Integer getOrderNumber() {
		return orderNumber;
	}

	public void setOrderNumber(Integer orderNumber) {
		this.orderNumber = orderNumber;
	}

	@Column(name = "level")
	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	@ManyToOne
	@JoinColumn(name = "parent_id")
	public TPrivilege getParent() {
		return parent;
	}

	public void setParent(TPrivilege parent) {
		this.parent = parent;
	}

}